{	Problem: http://codeforces.ru/problemset/problem/96/C
	 Verdict: Accepted
}
uses
        SysUtils, Math;

type
    al=array[1..2] of longint;

var
   i,n,kk,cc,x:longint;
   s,t,tt:string;
   b:array[0..110] of string;
   bb:array[0..110] of longint;
   a:array[0..10010] of al;
   k:array[0..110] of boolean;
   ch,bch:char;
   

procedure sort(l,r:longint);

var
        i,j,x:longint;
  y:al;

begin
i:=l;
j:=r;
x:=a[(l+r) shr 1][1];
repeat
        while a[i][1]<x do inc(i);
        while a[j][1]>x do dec(j);
        if i<=j then begin
                y:=a[i];
                a[i]:=a[j];
                a[j]:=y;
                inc(i);
                dec(j);
        end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end;

begin
fillchar(bb,sizeof(bb),0);
readln(n);
for i:=1 to n do begin
    readln(S);
    b[i]:=UpperCase(s);
    bb[i]:=length(S);
end;
readln(s);
read(ch);
bch:=UpCase(ch);
t:=upperCase(s);
fillchar(k,sizeof(k),false);
cc:=0;
for i:=1 to n do begin
    tt:=t;
    kk:=pos(b[i],tt);
    while kk>0 do begin
          inc(cc);
          a[cc][1]:=kk;
          a[cc][2]:=kk+bb[i]-1;
          tt[kk]:='$';  
          kk:=pos(b[i],tt); 
    end;
end;
sort(1,cc);
for i:=2 to cc do begin
    if a[i][2]<a[i-1][2] then a[i][1]:=-1 else
    if a[i][1]<=a[i-1][2] then a[i][1]:=a[i-1][2]+1;
end;
for i:=1 to cc do
    if a[i][1]>0 then begin
       for x:=a[i][1] to a[i][2] do begin
           if k[x] then continue;
           if s[x] in ['a'..'z'] then begin
              if (s[x]=ch) and (ch<>'a') then s[x]:='a' else
              if s[x]=ch then s[x]:='b' else s[x]:=ch;
           end else begin
               if (s[x]=bch) and (ch<>'a') then s[x]:='A' else
               if s[x]=bch then s[x]:='B' else s[x]:=bch;
           end;
           k[x]:=true;
       end;  
    end;
write(S);
end.